Make all text EXCEPT <input> unselectable in Internet Explorer? [migrated]

Posted by Ashli on Pro Webmasters See other posts from Pro Webmasters or by Ashli
Published on 2011-11-16T00:05:03Z Indexed on 2011/11/16 2:09 UTC
Read the original article Hit count: 153

Filed under:
|
|
|

I have a website where I want to disable users from selecting content EXCEPT for input areas. I currently have some CSS to disable user-select:

-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;

However, this does NOT cover Internet Explorer; thus, I need to implement some JavaScript:

<body onselectstart="return false;">

Through CSS and JavaScript, I can make all content unselectable across all popular browsers. BUT, this code also makes areas unselectable, which is a major case of poor usability. I use CSS to make input areas selectable:

-webkit-user-select: text;
-khtml-user-select: text;
-moz-user-select: text;
-o-user-select: text; 
user-select: text;

.. and as you might have expected, this does not cover Internet Explorer, since I used JavaScript to disable all content from being selectable.

What can I do to make all content unselectable except for input areas?

© Pro Webmasters or respective owner

Related posts about html

Related posts about css